let LibraryJsSDK = {
  $JsSDK: {},

  TestJsInt:function(a)
  {
      console.error("test js param int: " + a);
      return a;
  },
  
  TestJsString:function(str)
  {
    console.error("test js param string: " + UTF8ToString(str));

    var returnStr = "this string returnd from js";
    var bufferSize = lengthBytesUTF8(returnStr) + 1;
    var buffer = _malloc(bufferSize);
    stringToUTF8(returnStr, buffer, bufferSize);
    return buffer;
  },
  
  TestJsPrintFloatArray: function (array, size)
  {
    for(var i = 0; i < size; i++)
    {
      console.error("test js param float array[" + i + "]: " + HEAPF32[(array >> 2) + i]);
    }
  },
  
  TestJsCallback: function (callback, a, b)
  {
    JsSDK.callback = callback;
    Module['dynCall_vii'](JsSDK.callback, a, b);
  },
}

autoAddDeps(LibraryJsSDK, '$JsSDK');
mergeInto(LibraryManager.library, LibraryJsSDK);